dgb: port whale-departure detector (Phase 1c non-consensus heuristic) - #136
Closed
frstrtr wants to merge 5 commits into
Closed
dgb: port whale-departure detector (Phase 1c non-consensus heuristic)#136frstrtr wants to merge 5 commits into
frstrtr wants to merge 5 commits into
Conversation
The best-chain score() hardcoded a 15s block period (a dead farsider350 digibyte.py holdover) for time_span = block_height * BLOCK_PERIOD, bypassing the oracle-conformed PARENT.BLOCK_PERIOD (75s, config_coin.hpp). Source it from the make_coin_params-populated m_params->block_period so there is one SSOT for the DGB Scrypt-only parent period and no hardcoded consensus holdover in the score path. Stale confirmation comments updated (1=tip->75s).
Replace the compiling node.cpp/node.hpp skeleton with the full pool-layer NodeImpl, ported near-mechanically from impl/ltc (namespace ltc -> dgb; LevelDB net names litecoin -> digibyte). node.cpp now compiles share_tracker.hpp and share_check.hpp into a real translation unit, exercising the chain-score path. - node.hpp: BaseNode<dgb::Config, dgb::ShareChain, dgb::Peer>, async share downloader, tracker mutex/compute pipeline, broadcast, download, admin API. Config aggregator (core::Config<PoolConfig, CoinConfig>) declared inline since the dgb tree splits config into config_pool.hpp + config_coin.hpp (no config.hpp aggregator header). - node.cpp: full run-loop body (think, clean_tracker, prune, PPLNS window, heartbeat, outbound connection maintenance, whitelist/ban admin). - protocol_actual.cpp / protocol_legacy.cpp: per-message handlers (Actual/Legacy). - config_pool.cpp / config_coin.cpp: Fileconfig load()/get_default() bodies; config_coin.hpp gains the YAML convert<> specializations for P2PData/RPCData. - CMakeLists.txt: add dgb OBJECT lib (mirrors ltc lib) linking core/pool/sharechain/dgb_coin/btclibs/c2pool_storage/secp256k1; the dgb NodeImpl TU builds clean (target dgb). Coin-isolation preserved: changes confined to src/impl/dgb/. Wiring the c2pool-dgb executable to this lib requires edits in src/c2pool/ (main_dgb.cpp + CMakeLists.txt) which are out of scope for this slice.
The exe-wire slice repairs c2pool-dgb after #134 replaced the skeleton node.cpp with the real abstract dgb::NodeImpl, orphaning the run_skeleton/network_summary symbols the old stub main linked against. main_dgb.cpp now drives the LIVE score path: it constructs dgb::ShareTracker and calls score() (header-only, #132/#134), reporting the oracle block_period (75s SSOT) the time_span derivation consumes. It never stands up the abstract NodeImpl, so the full pool run-loop is not pulled in. Isolation: the real node.cpp TU references core web_server/stratum, which the core OBJECT lib links unconditionally and which drag in payout/merged/hashrate/ ltc (Phase B self-link tangle; merged = DOGE aux, NOT in the V36 default DGB build). We therefore do NOT compile node.cpp into the exe and do NOT link core. Instead we compile core/uint256.cpp directly and link the btclibs STATIC util lib (HexStr/HexDigit) - pure utility, no pool runtime. Per-coin isolation held; only the c2pool-dgb target changed; sibling coin exes still build.
Port of LTC whale_departure.hpp into the dgb namespace: 30-min rolling hashrate window that detects whale departure (drop below 50% baseline) and signals desired-target override toward pre_target3. Non-consensus, local-only; matches p2pool-v36 work.py Phase 1c + 1c.1. Compiled into the real node TU as an additive NodeImpl member; detect() wiring into the desired-target path is the next slice. No shared-base or src/core churn, single-tree under src/impl/dgb. c2pool-dgb builds clean.
…ride Drive WhaleDepartureDetector::detect() from run_think() under the exclusive tracker lock with the fresh best-share hash (race-free, share-batch cadence). Publish the verdict to an atomic m_whale_departure_active and expose local_desired_target(): when recovery is active the local mining target is eased to pre_target3 (== MAX_TARGET, easiest consensus difficulty); otherwise the normal desired target passes through. Non-consensus -- only affects what this node mines, never share verification. Closes the loop on the pillar landed in the prior slice (detector was dormant until it drove the override). 3-bucket: per-coin isolation (non-consensus local heuristic, src/impl/dgb/ only). redistribute.hpp deferred -- not a hard compile dep (comment-only reference in share_check.hpp; file absent on branch).
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase B pool/share slice (family-1). Ports LTCs whale_departure.hpp into the dgb namespace: 30-min rolling hashrate window, triggers at <50% baseline, signals desired-target override toward pre_target3. Non-consensus / local-only, no oracle byte-parity surface. Compiled into the real node TU via an additive NodeImpl member; detect() wiring into the desired-target path is the next slice.
Stacked on dgb/exe-wire (#135 batch). c2pool-dgb builds clean (EXIT=0). Single-tree under src/impl/dgb, no shared-base or src/core churn. HOLD merge pending operators batched-merge tap.